<?php
	function pick_article($sql_select,$debug){
		$db =  new mysql();
		//$sql_select="select news_url from news_info where news_id=".$artileid;
		$query = $db->query($sql_select);
		$artile = $db->fetch_row_array($query);
		
		if(empty($artile)){
			return -1;
		}
		//print_r($artile);
		$baseurl=$artile["news_url"];
		$artileid = $artile["news_id"];
		if($debug){
			echo "url:".$baseurl."<br>";
		}	
		//读远程url
		
		$contents = myfile_get_content($baseurl);
		
		$html = str_get_html($contents);
		$news_content = '';
		foreach($html->find('div#Cnt-Main-Article-QQ') as $article) {
			$news_content = $article->xmltext;
		}
		
		$news_file = $GLOBALS ['web'] ['data'].$artileid.".txt";
		makehtml($news_file,$news_content);
		
		$update_sql = "update news_info set news_file = '".$news_file."', pick_time = '".date('YmdHis')."',picked=1 where news_id=".$artileid;
		echo $news_content;
		if($debug){
			$db->query($update_sql);
		}
		echo "采集完成";
		return 1;
	}
	
	
?>